/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package db;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author devashish
 */
@Entity
@Table(name = "label")
@NamedQueries({
    @NamedQuery(name = "Label.findAll", query = "SELECT l FROM Label l"),
    @NamedQuery(name = "Label.findByLabelId", query = "SELECT l FROM Label l WHERE l.labelId = :labelId"),
    @NamedQuery(name = "Label.findByLabelName", query = "SELECT l FROM Label l WHERE l.labelName = :labelName"),
    @NamedQuery(name = "Label.findByParentLabelId", query = "SELECT l FROM Label l WHERE l.parentLabelId = :parentLabelId"),
    @NamedQuery(name = "Label.findByLabelLocation", query = "SELECT l FROM Label l WHERE l.labelLocation = :labelLocation")})
public class Label implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "LabelId")
    private Long labelId;
    @Basic(optional = false)
    @Column(name = "LabelName")
    private String labelName;
    @Basic(optional = false)
    @Column(name = "ParentLabelId")
    private long parentLabelId;
    @Basic(optional = false)
    @Column(name = "LabelLocation")
    private String labelLocation;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "label")
    private Collection<Results> resultsCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "label1")
    private Collection<Results> resultsCollection1;
    @JoinColumn(name = "LabelTypeId", referencedColumnName = "LabelTypeId")
    @ManyToOne(optional = false)
    private Labeltypes labelTypeId;
    @JoinColumn(name = "LabelTypeId", referencedColumnName = "LabelTypeId")
    @ManyToOne(optional = false)
    private Labeltypes labelTypeId1;

    public Label() {
    }

    public Label(Long labelId) {
        this.labelId = labelId;
    }

    public Label(Long labelId, String labelName, long parentLabelId, String labelLocation) {
        this.labelId = labelId;
        this.labelName = labelName;
        this.parentLabelId = parentLabelId;
        this.labelLocation = labelLocation;
    }

    public Long getLabelId() {
        return labelId;
    }

    public void setLabelId(Long labelId) {
        this.labelId = labelId;
    }

    public String getLabelName() {
        return labelName;
    }

    public void setLabelName(String labelName) {
        this.labelName = labelName;
    }

    public long getParentLabelId() {
        return parentLabelId;
    }

    public void setParentLabelId(long parentLabelId) {
        this.parentLabelId = parentLabelId;
    }

    public String getLabelLocation() {
        return labelLocation;
    }

    public void setLabelLocation(String labelLocation) {
        this.labelLocation = labelLocation;
    }

    public Collection<Results> getResultsCollection() {
        return resultsCollection;
    }

    public void setResultsCollection(Collection<Results> resultsCollection) {
        this.resultsCollection = resultsCollection;
    }

    public Collection<Results> getResultsCollection1() {
        return resultsCollection1;
    }

    public void setResultsCollection1(Collection<Results> resultsCollection1) {
        this.resultsCollection1 = resultsCollection1;
    }

    public Labeltypes getLabelTypeId() {
        return labelTypeId;
    }

    public void setLabelTypeId(Labeltypes labelTypeId) {
        this.labelTypeId = labelTypeId;
    }

    public Labeltypes getLabelTypeId1() {
        return labelTypeId1;
    }

    public void setLabelTypeId1(Labeltypes labelTypeId1) {
        this.labelTypeId1 = labelTypeId1;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (labelId != null ? labelId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Label)) {
            return false;
        }
        Label other = (Label) object;
        if ((this.labelId == null && other.labelId != null) || (this.labelId != null && !this.labelId.equals(other.labelId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "db.Label[labelId=" + labelId + "]";
    }

}
